//
//  AddressPicker.h
//  青旅O2O
//
//  Created by qlwl on 16/6/7.
//  Copyright © 2016年 qlwl. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN
@protocol PickerViewDataSource, PickerViewDelegate;

@interface AddressPicker : UIView
{
    UIColor * _bgColor;
}
+(instancetype)addressPickerView;
+(instancetype)showInWindowWithSureClick:(void(^)(void))sureClick;
- (void)showInView:(UIView *)supView;
- (void)remove;
@property (nonatomic, strong)void (^sureBtnClick) (void) ;
@property (nonatomic, assign) BOOL isLoding ; //
@property (nonatomic, assign, readonly) BOOL isShow ;//
@property (nonatomic, copy) UIColor * bgColor;//背景颜色

- (void) setTopHeadColor:(UIColor *)topColor;// 顶部横条的颜色设置
- (void) setTopTitle:(NSString *) title; // 设置顶部横条的标题
- (void) setTopTitleColor:(UIColor *) titleColor; // 设置标题颜色
- (void) setSureOrCancelBtnColor:(UIColor *) btnColor; // 设置取消确定按钮颜色

#pragma mark  系统的属性和方法
@property(nullable,nonatomic,weak) id<PickerViewDataSource> dataSource;                // default is nil. weak reference
@property(nullable,nonatomic,weak) id<PickerViewDelegate>   delegate;                  // default is nil. weak reference
@property(nonatomic)        BOOL                       showsSelectionIndicator;   // default is NO

@property(nonatomic,readonly) NSInteger numberOfComponents;
- (NSInteger)numberOfRowsInComponent:(NSInteger)component;
- (CGSize)rowSizeForComponent:(NSInteger)component;
- (nullable UIView *)viewForRow:(NSInteger)row forComponent:(NSInteger)component;

- (void)reloadAllComponents;
- (void)reloadComponent:(NSInteger)component;

- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated;
- (NSInteger)selectedRowInComponent:(NSInteger)component;
@end

__TVOS_PROHIBITED
@protocol PickerViewDataSource<NSObject>
@required

// returns the number of 'columns' to display.
- (NSInteger)numberOfComponentsInPickerView:(AddressPicker *)pickerView;

// returns the # of rows in each component..
- (NSInteger)pickerView:(AddressPicker *)pickerView numberOfRowsInComponent:(NSInteger)component;
@end

__TVOS_PROHIBITED
@protocol PickerViewDelegate<NSObject>
@optional

- (CGFloat)pickerView:(AddressPicker *)pickerView widthForComponent:(NSInteger)component __TVOS_PROHIBITED;
- (CGFloat)pickerView:(AddressPicker *)pickerView rowHeightForComponent:(NSInteger)component __TVOS_PROHIBITED;

- (nullable NSString *)pickerView:(AddressPicker *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component __TVOS_PROHIBITED;
- (nullable NSAttributedString *)pickerView:(AddressPicker *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component NS_AVAILABLE_IOS(6_0) __TVOS_PROHIBITED;
- (UIView *)pickerView:(AddressPicker *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view __TVOS_PROHIBITED;

- (void)pickerView:(AddressPicker *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component __TVOS_PROHIBITED;

@end

NS_ASSUME_NONNULL_END
